<template>
  <div id="search-id">
    <c-title text="搜索"></c-title>
    <div class="search-box">
      <ul class="search">
        <li class="right">
          <i class="iconfont icon-a-icon_pressed"></i>
          <form action="#" style="width: 100%;">
            <input type="search" title="搜索" placeholder="请输入内容" v-model="search_title" @keypress="searchData" />
          </form>
        </li>
        <i class="iconfont icon-leimupinleifenleileibie2" @click="permutation = !permutation"></i>
      </ul>
    </div>
    <div class="goods-row">
      <div class="top-tab">
        <!-- @click="chooseTab(item)" -->
        <div class="lab-rol" v-for="(item, index) in typeList" :key="index" @click="chooseTab(item)">
          <span :class="item.active ? 'active-color lab-name' : 'lab-name'">{{ item.name }}</span>
          <span class="lab-icon">
            <!-- " @click="chooseTab(item,'asc')" -->
            <i :class="item.active && item.sort == 'asc' ? 'active-color iconfont icon-up' : 'iconfont icon-up'"></i>
            <!-- " @click="chooseTab(item,'desc')" -->
            <i :class="item.active && item.sort == 'desc' ? 'active-color iconfont icon-down' : 'iconfont icon-down'"></i>
          </span>
        </div>
      </div>
      <d-list :loading="loading" :finished="finished" @load="onLoad">
        <div :class="permutation ? 'mall-detail' : 'cross-mall-detail'">
          <div class="cross-box" v-for="(item, index) in goodsList" :key="index" @click="goGoodsDetail(item.id)">
            <img :src="item.thumb" alt="" />
            <div class="content">
              <div class="title">{{ item.title }}</div>
              <div class="price">¥{{ item.price }}</div>
              <div class="member-price">会员价 ¥{{ item.vip_price }}</div>
            </div>
          </div>
        </div>
      </d-list>
    </div>
  </div>
</template>
<script>
import search_controller from "./search_controller";

export default search_controller;
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
input[type="search"] {
  -webkit-appearance: none;
}
.search-box {
  .search {
    height: 2.75rem;
    line-height: 2.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.7rem;
    background-color: #fff;
    .right {
      width: 88%;
      height: 1.875rem;
      background: #f5f5f5;
      display: flex;
      line-height: 1.875rem;
      border-radius: 1rem;
      padding: 0 0.625rem;
      font-size: 0.75rem;

      i {
        font-size: 1.1rem;
        color: #999;
        margin-right: 0.2rem;
      }

      input {
        border: none;
        width: 100%;
      }
    }
    .icon-leimupinleifenleileibie2 {
      margin-right: 0.5rem;
    }
  }
}
.goods-row {
  .top-tab {
    display: flex;
    justify-content: space-around;
    background: white;
    padding: 0.58rem 0;
    .lab-rol {
      display: flex;
      .lab-name {
        font-size: 0.85rem;
        font-weight: 400;
        color: #6e6e79;
      }
      .lab-icon {
        display: flex;
        flex-direction: column;
        line-height: 0.95rem;
        .iconfont {
          color: #aaaab3;
          font-size: 0.7rem;
          height: 0.4rem;
        }
      }
      .active-color {
        font-weight: 500;
        color: #f15353 !important;
      }
    }
  }
  .mall-detail {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 0.7rem;
    padding: 0 0.7rem;
    .cross-box {
      border-radius: 0.6rem;
      text-align: left;
      background: white;
      .title {
        font-size: 0.8rem;
        font-weight: bold;
        color: #00001c;
        line-height: 0.9rem;
        margin: 0.1rem 0.85rem 0.1rem 0.8rem;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        // height: 2.2rem;
        line-height: 1.3;
      }
      .price {
        font-size: 0.9rem;
        font-weight: bold;
        color: #f15353;
        margin: 0 0.85rem 0.2rem 0.8rem;
      }
      img {
        height: 10.5rem;
        background: #c1c1c1;
        border-radius: 0.6rem 0.6rem 0rem 0rem;
        margin: 0;
        width: 100%;
      }
      .member-price {
        font-size: 0.75rem;
        font-weight: 400;
        color: #3b3b4a;
        margin: 0 0.85rem 0.8rem 0.8rem;
      }
    }
  }
  .cross-mall-detail {
    padding: 0.6rem;
    .cross-box {
      background: white;
      border-radius: 0.6rem;
      display: flex;
      padding: 0.6rem;
      margin-bottom: 0.6rem;
      img {
        margin: 0;
        width: 5.2rem;
        height: 5.2rem;
        border-radius: 0.6rem;
        background: #c1c1c1;
      }
      .content {
        display: flex;
        flex-direction: column;
        text-align: left;
        justify-content: space-between;
        margin-left: 0.5rem;
        padding: 0.2rem 0;
        .title {
          font-size: 0.8rem;
          font-weight: bold;
          color: #00001c;
          overflow: hidden;
          text-overflow: ellipsis;
          -webkit-line-clamp: 2;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          height: 2.3rem;
          margin-bottom: 0.2rem;
        }
        .price {
          font-size: 0.9rem;
          font-weight: bold;
          color: #f15353;
        }
        .member-price {
          font-size: 0.75rem;
          font-weight: 400;
          color: #3b3b4a;
        }
      }
    }
  }
}
</style>
